using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace MatrixFramework.Shared.Domain.Photos
{
    /// <summary>
    /// 照片-相册关联实体
    /// 支持照片属于多个相册的多对多关系
    /// </summary>
    public class PhotoGallery : FullAuditedEntity<Guid>, IMultiTenant
    {
        /// <summary>
        /// 租户ID
        /// </summary>
        public virtual Guid? TenantId { get; protected set; }

        /// <summary>
        /// 照片ID
        /// </summary>
        public virtual Guid PhotoId { get; protected set; }

        /// <summary>
        /// 相册ID
        /// </summary>
        public virtual Guid GalleryId { get; protected set; }

        /// <summary>
        /// 是否为主要相册
        /// </summary>
        public virtual bool IsPrimary { get; protected set; }

        /// <summary>
        /// 排序顺序
        /// </summary>
        public virtual int SortOrder { get; protected set; }

        /// <summary>
        /// 添加时间
        /// </summary>
        public virtual DateTime AddedTime { get; protected set; }

        /// <summary>
        /// 添加者ID
        /// </summary>
        public virtual Guid? AddedById { get; protected set; }

        /// <summary>
        /// 添加者名称
        /// </summary>
        [MaxLength(200)]
        public virtual string AddedByName { get; protected set; }

        /// <summary>
        /// 关联备注
        /// </summary>
        [MaxLength(500)]
        public virtual string Notes { get; protected set; }

        /// <summary>
        /// 关联元数据
        /// </summary>
        public virtual Dictionary<string, object> Metadata { get; protected set; }

        /// <summary>
        /// 照片导航属性
        /// </summary>
        public virtual Photo Photo { get; protected set; }

        /// <summary>
        /// 相册导航属性
        /// </summary>
        public virtual Gallery Gallery { get; protected set; }

        protected PhotoGallery()
        {
            Metadata = new Dictionary<string, object>();
        }

        public PhotoGallery(
            Guid id,
            Guid photoId,
            Guid galleryId,
            bool isPrimary = false,
            int sortOrder = 0,
            Guid? tenantId = null) : base(id)
        {
            PhotoId = photoId;
            GalleryId = galleryId;
            IsPrimary = isPrimary;
            SortOrder = sortOrder;
            TenantId = tenantId;
            AddedTime = DateTime.Now;

            Metadata = new Dictionary<string, object>();
        }

        /// <summary>
        /// 设置为主要相册
        /// </summary>
        public virtual void SetAsPrimary()
        {
            IsPrimary = true;
        }

        /// <summary>
        /// 取消主要相册状态
        /// </summary>
        public virtual void UnsetAsPrimary()
        {
            IsPrimary = false;
        }

        /// <summary>
        /// 更新排序顺序
        /// </summary>
        public virtual void UpdateSortOrder(int sortOrder)
        {
            SortOrder = sortOrder;
        }

        /// <summary>
        /// 更新关联备注
        /// </summary>
        public virtual void UpdateNotes(string notes)
        {
            Notes = notes;
        }

        /// <summary>
        /// 设置添加者信息
        /// </summary>
        public virtual void SetAddedBy(Guid addedById, string addedByName)
        {
            AddedById = addedById;
            AddedByName = addedByName;
        }

        /// <summary>
        /// 更新元数据
        /// </summary>
        public virtual void UpdateMetadata(Dictionary<string, object> metadata)
        {
            Metadata = metadata ?? new Dictionary<string, object>();
        }

        /// <summary>
        /// 设置元数据项
        /// </summary>
        public virtual void SetMetadata(string key, object value)
        {
            Metadata[key] = value;
        }

        /// <summary>
        /// 移除元数据项
        /// </summary>
        public virtual void RemoveMetadata(string key)
        {
            Metadata.Remove(key);
        }
    }

    /// <summary>
    /// 照片人脸识别实体
    /// </summary>
    public class PhotoFace : FullAuditedEntity<Guid>, IMultiTenant
    {
        /// <summary>
        /// 租户ID
        /// </summary>
        public virtual Guid? TenantId { get; protected set; }

        /// <summary>
        /// 照片ID
        /// </summary>
        public virtual Guid PhotoId { get; protected set; }

        /// <summary>
        /// 人物ID（如果已识别）
        /// </summary>
        public virtual Guid? PersonId { get; protected set; }

        /// <summary>
        /// 人脸特征数据
        /// </summary>
        public virtual byte[] FaceFeatures { get; protected set; }

        /// <summary>
        /// 人脸边界框
        /// </summary>
        public virtual BoundingBox FaceBoundingBox { get; protected set; }

        /// <summary>
        /// 人脸置信度
        /// </summary>
        public virtual double Confidence { get; protected set; }

        /// <summary>
        /// 年龄估计
        /// </summary>
        public virtual int? EstimatedAge { get; protected set; }

        /// <summary>
        /// 性别
        /// </summary>
        public virtual Gender? Gender { get; protected set; }

        /// <summary>
        /// 情绪
        /// </summary>
        public virtual Emotion? Emotion { get; protected set; }

        /// <summary>
        /// 人脸质量评分
        /// </summary>
        public virtual double QualityScore { get; protected set; }

        /// <summary>
        /// 识别状态
        /// </summary>
        public virtual FaceRecognitionStatus RecognitionStatus { get; protected set; }

        /// <summary>
        /// 是否为主要人脸
        /// </summary>
        public virtual bool IsMainFace { get; protected set; }

        /// <summary>
        /// 人脸角度
        /// </summary>
        public virtual FacePose FacePose { get; protected set; }

        /// <summary>
        /// 人脸属性
        /// </summary>
        public virtual Dictionary<string, object> FaceAttributes { get; protected set; }

        /// <summary>
        /// 分析时间
        /// </summary>
        public virtual DateTime AnalysisTime { get; protected set; }

        /// <summary>
        /// 分析算法版本
        /// </summary>
        [MaxLength(50)]
        public virtual string AnalysisVersion { get; protected set; }

        /// <summary>
        /// 照片导航属性
        /// </summary>
        public virtual Photo Photo { get; protected set; }

        /// <summary>
        /// 人物导航属性
        /// </summary>
        public virtual Person Person { get; protected set; }

        protected PhotoFace()
        {
            FaceBoundingBox = new BoundingBox();
            FacePose = new FacePose();
            FaceAttributes = new Dictionary<string, object>();
        }

        public PhotoFace(
            Guid id,
            Guid photoId,
            byte[] faceFeatures,
            BoundingBox faceBoundingBox,
            double confidence,
            Guid? tenantId = null) : base(id)
        {
            PhotoId = photoId;
            FaceFeatures = faceFeatures;
            FaceBoundingBox = faceBoundingBox ?? new BoundingBox();
            Confidence = confidence;
            TenantId = tenantId;
            RecognitionStatus = FaceRecognitionStatus.Detected;
            AnalysisTime = DateTime.Now;

            FacePose = new FacePose();
            FaceAttributes = new Dictionary<string, object>();
        }

        /// <summary>
        /// 设置人物信息
        /// </summary>
        public virtual void SetPerson(Guid? personId)
        {
            PersonId = personId;
            if (personId.HasValue)
            {
                RecognitionStatus = FaceRecognitionStatus.Recognized;
            }
            else
            {
                RecognitionStatus = FaceRecognitionStatus.Detected;
            }
        }

        /// <summary>
        /// 更新人脸属性
        /// </summary>
        public virtual void UpdateFaceAttributes(
            int? estimatedAge = null,
            Gender? gender = null,
            Emotion? emotion = null,
            double? qualityScore = null,
            FacePose facePose = null)
        {
            EstimatedAge = estimatedAge;
            Gender = gender;
            Emotion = emotion;
            QualityScore = qualityScore ?? QualityScore;
            FacePose = facePose ?? FacePose;
        }

        /// <summary>
        /// 设置为主要人脸
        /// </summary>
        public virtual void SetAsMainFace()
        {
            IsMainFace = true;
        }

        /// <summary>
        /// 取消主要人脸状态
        /// </summary>
        public virtual void UnsetAsMainFace()
        {
            IsMainFace = false;
        }

        /// <summary>
        /// 更新识别状态
        /// </summary>
        public virtual void UpdateRecognitionStatus(FaceRecognitionStatus status)
        {
            RecognitionStatus = status;
        }

        /// <summary>
        /// 更新人脸属性字典
        /// </summary>
        public virtual void UpdateFaceAttributes(Dictionary<string, object> attributes)
        {
            FaceAttributes = attributes ?? new Dictionary<string, object>();
        }

        /// <summary>
        /// 设置人脸属性项
        /// </summary>
        public virtual void SetFaceAttribute(string key, object value)
        {
            FaceAttributes[key] = value;
        }

        /// <summary>
        /// 检查是否已识别
        /// </summary>
        public virtual bool IsRecognized => RecognitionStatus == FaceRecognitionStatus.Recognized;

        /// <summary>
        /// 检查是否为高质量人脸
        /// </summary>
        public virtual bool IsHighQuality => QualityScore >= 0.8;
    }

    /// <summary>
    /// 性别枚举
    /// </summary>
    public enum Gender
    {
        /// <summary>
        /// 男性
        /// </summary>
        Male = 0,

        /// <summary>
        /// 女性
        /// </summary>
        Female = 1,

        /// <summary>
        /// 未知
        /// </summary>
        Unknown = 2
    }

    /// <summary>
    /// 情绪枚举
    /// </summary>
    public enum Emotion
    {
        /// <summary>
        /// 开心
        /// </summary>
        Happy = 0,

        /// <summary>
        /// 悲伤
        /// </summary>
        Sad = 1,

        /// <summary>
        /// 愤怒
        /// </summary>
        Angry = 2,

        /// <summary>
        /// 惊讶
        /// </summary>
        Surprised = 3,

        /// <summary>
        /// 恐惧
        /// </summary>
        Fear = 4,

        /// <summary>
        /// 厌恶
        /// </summary>
        Disgust = 5,

        /// <summary>
        /// 中性
        /// </summary>
        Neutral = 6,

        /// <summary>
        /// 困惑
        /// </summary>
        Confused = 7
    }

    /// <summary>
    /// 人脸识别状态枚举
    /// </summary>
    public enum FaceRecognitionStatus
    {
        /// <summary>
        /// 已检测
        /// </summary>
        Detected = 0,

        /// <summary>
        /// 已识别
        /// </summary>
        Recognized = 1,

        /// <summary>
        /// 未识别
        /// </summary>
        Unrecognized = 2,

        /// <summary>
        /// 需要人工审核
        /// </summary>
        NeedsReview = 3,

        /// <summary>
        /// 识别失败
        /// </summary>
        Failed = 4
    }

    /// <summary>
    /// 人脸姿态
    /// </summary>
    public class FacePose
    {
        /// <summary>
        /// 偏航角（左右转头）
        /// </summary>
        public double Yaw { get; set; }

        /// <summary>
        /// 俯仰角（上下抬头）
        /// </summary>
        public double Pitch { get; set; }

        /// <summary>
        /// 翻滚角（左右倾斜）
        /// </summary>
        public double Roll { get; set; }

        /// <summary>
        /// 人脸角度质量评分
        /// </summary>
        public double PoseQuality { get; set; }

        /// <summary>
        /// 是否为正面人脸
        /// </summary>
        public bool IsFrontal => Math.Abs(Yaw) < 15 && Math.Abs(Pitch) < 15 && Math.Abs(Roll) < 15;
    }

    /// <summary>
    /// 照片评论实体
    /// </summary>
    public class PhotoComment : FullAuditedEntity<Guid>, IMultiTenant
    {
        /// <summary>
        /// 租户ID
        /// </summary>
        public virtual Guid? TenantId { get; protected set; }

        /// <summary>
        /// 照片ID
        /// </summary>
        public virtual Guid PhotoId { get; protected set; }

        /// <summary>
        /// 父评论ID（支持回复）
        /// </summary>
        public virtual Guid? ParentCommentId { get; protected set; }

        /// <summary>
        /// 评论者ID
        /// </summary>
        public virtual Guid CommenterId { get; protected set; }

        /// <summary>
        /// 评论者名称
        /// </summary>
        [Required]
        [MaxLength(200)]
        public virtual string CommenterName { get; protected set; }

        /// <summary>
        /// 评论者头像URL
        /// </summary>
        [MaxLength(500)]
        public virtual string CommenterAvatarUrl { get; protected set; }

        /// <summary>
        /// 评论内容
        /// </summary>
        [Required]
        [MaxLength(2000)]
        public virtual string Content { get; protected set; }

        /// <summary>
        /// 评论类型
        /// </summary>
        public virtual CommentType CommentType { get; protected set; }

        /// <summary>
        /// 是否已删除
        /// </summary>
        public virtual bool IsDeleted { get; protected set; }

        /// <summary>
        /// 删除时间
        /// </summary>
        public virtual DateTime? DeletionTime { get; protected set; }

        /// <summary>
        /// 删除者ID
        /// </summary>
        public virtual Guid? DeleterId { get; protected set; }

        /// <summary>
        /// 删除原因
        /// </summary>
        [MaxLength(500)]
        public virtual string DeletionReason { get; protected set; }

        /// <summary>
        /// 点赞数
        /// </summary>
        public virtual int LikeCount { get; protected set; }

        /// <summary>
        /// 回复数
        /// </summary>
        public virtual int ReplyCount { get; protected set; }

        /// <summary>
        /// 是否置顶
        /// </summary>
        public virtual bool IsPinned { get; protected set; }

        /// <summary>
        /// 置顶时间
        /// </summary>
        public virtual DateTime? PinTime { get; protected set; }

        /// <summary>
        /// 照片导航属性
        /// </summary>
        public virtual Photo Photo { get; protected set; }

        /// <summary>
        /// 父评论导航属性
        /// </summary>
        public virtual PhotoComment ParentComment { get; protected set; }

        /// <summary>
        /// 子评论集合
        /// </summary>
        public virtual ICollection<PhotoComment> Replies { get; protected set; }

        /// <summary>
        /// 点赞记录
        /// </summary>
        public virtual ICollection<CommentLike> Likes { get; protected set; }

        protected PhotoComment()
        {
            Replies = new List<PhotoComment>();
            Likes = new List<CommentLike>();
        }

        public PhotoComment(
            Guid id,
            Guid photoId,
            Guid commenterId,
            string commenterName,
            string content,
            CommentType commentType = CommentType.User,
            Guid? parentCommentId = null,
            Guid? tenantId = null) : base(id)
        {
            PhotoId = photoId;
            ParentCommentId = parentCommentId;
            CommenterId = commenterId;
            CommenterName = commenterName;
            Content = content;
            CommentType = commentType;
            TenantId = tenantId;

            Replies = new List<PhotoComment>();
            Likes = new List<CommentLike>();
        }

        /// <summary>
        /// 更新评论内容
        /// </summary>
        public virtual void UpdateContent(string content)
        {
            Content = content;
        }

        /// <summary>
        /// 删除评论
        /// </summary>
        public virtual void DeleteComment(Guid deleterId, string reason = null)
        {
            IsDeleted = true;
            DeletionTime = DateTime.Now;
            DeleterId = deleterId;
            DeletionReason = reason;
        }

        /// <summary>
        /// 恢复评论
        /// </summary>
        public virtual void RestoreComment()
        {
            IsDeleted = false;
            DeletionTime = null;
            DeleterId = null;
            DeletionReason = null;
        }

        /// <summary>
        /// 增加点赞数
        /// </summary>
        public virtual void IncrementLikeCount()
        {
            LikeCount++;
        }

        /// <summary>
        /// 减少点赞数
        /// </summary>
        public virtual void DecrementLikeCount()
        {
            LikeCount = Math.Max(0, LikeCount - 1);
        }

        /// <summary>
        /// 增加回复数
        /// </summary>
        public virtual void IncrementReplyCount()
        {
            ReplyCount++;
        }

        /// <summary>
        /// 减少回复数
        /// </summary>
        public virtual void DecrementReplyCount()
        {
            ReplyCount = Math.Max(0, ReplyCount - 1);
        }

        /// <summary>
        /// 置顶评论
        /// </summary>
        public virtual void PinComment()
        {
            IsPinned = true;
            PinTime = DateTime.Now;
        }

        /// <summary>
        /// 取消置顶
        /// </summary>
        public virtual void UnpinComment()
        {
            IsPinned = false;
            PinTime = null;
        }

        /// <summary>
        /// 检查是否可以编辑
        /// </summary>
        public virtual bool CanEdit(Guid userId)
        {
            return CommenterId == userId && !IsDeleted;
        }

        /// <summary>
        /// 检查是否可以删除
        /// </summary>
        public virtual bool CanDelete(Guid userId)
        {
            return CommenterId == userId && !IsDeleted;
        }

        /// <summary>
        /// 检查是否为回复
        /// </summary>
        public virtual bool IsReply => ParentCommentId.HasValue;

        /// <summary>
        /// 获取评论层级深度
        /// </summary>
        public virtual int GetDepth()
        {
            if (!IsReply)
                return 0;

            // 简单实现，实际应用中可能需要递归查询父评论
            return 1;
        }
    }

    /// <summary>
    /// 评论类型枚举
    /// </summary>
    public enum CommentType
    {
        /// <summary>
        /// 用户评论
        /// </summary>
        User = 0,

        /// <summary>
        /// 系统评论
        /// </summary>
        System = 1,

        /// <summary>
        /// AI生成评论
        /// </summary>
        AI = 2,

        /// <summary>
        /// 自动评论
        /// </summary>
        Auto = 3
    }

    /// <summary>
    /// 评论点赞实体
    /// </summary>
    public class CommentLike : FullAuditedEntity<Guid>, IMultiTenant
    {
        /// <summary>
        /// 租户ID
        /// </summary>
        public virtual Guid? TenantId { get; protected set; }

        /// <summary>
        /// 评论ID
        /// </summary>
        public virtual Guid CommentId { get; protected set; }

        /// <summary>
        /// 点赞用户ID
        /// </summary>
        public virtual Guid UserId { get; protected set; }

        /// <summary>
        /// 点赞用户名称
        /// </summary>
        [Required]
        [MaxLength(200)]
        public virtual string UserName { get; protected set; }

        /// <summary>
        /// 评论导航属性
        /// </summary>
        public virtual PhotoComment Comment { get; protected set; }

        protected CommentLike() { }

        public CommentLike(
            Guid id,
            Guid commentId,
            Guid userId,
            string userName,
            Guid? tenantId = null) : base(id)
        {
            CommentId = commentId;
            UserId = userId;
            UserName = userName;
            TenantId = tenantId;
        }
    }

    /// <summary>
    /// 照片分享实体
    /// </summary>
    public class PhotoShare : FullAuditedEntity<Guid>, IMultiTenant
    {
        /// <summary>
        /// 租户ID
        /// </summary>
        public virtual Guid? TenantId { get; protected set; }

        /// <summary>
        /// 照片ID
        /// </summary>
        public virtual Guid PhotoId { get; protected set; }

        /// <summary>
        /// 分享者ID
        /// </summary>
        public virtual Guid SharerId { get; protected set; }

        /// <summary>
        /// 分享者名称
        /// </summary>
        [Required]
        [MaxLength(200)]
        public virtual string SharerName { get; protected set; }

        /// <summary>
        /// 分享类型
        /// </summary>
        public virtual ShareType ShareType { get; protected set; }

        /// <summary>
        /// 分享目标（如平台、用户ID等）
        /// </summary>
        [MaxLength(500)]
        public virtual string ShareTarget { get; protected set; }

        /// <summary>
        /// 分享URL
        /// </summary>
        [MaxLength(2000)]
        public virtual string ShareUrl { get; protected set; }

        /// <summary>
        /// 分享标题
        /// </summary>
        [MaxLength(500)]
        public virtual string ShareTitle { get; protected set; }

        /// <summary>
        /// 分享描述
        /// </summary>
        [MaxLength(1000)]
        public virtual string ShareDescription { get; protected set; }

        /// <summary>
        /// 分享状态
        /// </summary>
        public virtual ShareStatus ShareStatus { get; protected set; }

        /// <summary>
        /// 访问次数
        /// </summary>
        public virtual int AccessCount { get; protected set; }

        /// <summary>
        /// 最后访问时间
        /// </summary>
        public virtual DateTime? LastAccessTime { get; protected set; }

        /// <summary>
        /// 过期时间
        /// </summary>
        public virtual DateTime? ExpirationTime { get; protected set; }

        /// <summary>
        /// 是否需要密码
        /// </summary>
        public virtual bool RequiresPassword { get; protected set; }

        /// <summary>
        /// 访问密码
        /// </summary>
        [MaxLength(100)]
        public virtual string AccessPassword { get; protected set; }

        /// <summary>
        /// 分享权限
        /// </summary>
        public virtual SharePermissions Permissions { get; protected set; }

        /// <summary>
        /// 照片导航属性
        /// </summary>
        public virtual Photo Photo { get; protected set; }

        protected PhotoShare()
        {
            Permissions = new SharePermissions();
        }

        public PhotoShare(
            Guid id,
            Guid photoId,
            Guid sharerId,
            string sharerName,
            ShareType shareType,
            string shareTarget = null,
            Guid? tenantId = null) : base(id)
        {
            PhotoId = photoId;
            SharerId = sharerId;
            SharerName = sharerName;
            ShareType = shareType;
            ShareTarget = shareTarget;
            ShareStatus = ShareStatus.Active;
            TenantId = tenantId;

            Permissions = new SharePermissions();
        }

        /// <summary>
        /// 更新分享信息
        /// </summary>
        public virtual void UpdateShareInfo(
            string shareTitle = null,
            string shareDescription = null,
            DateTime? expirationTime = null)
        {
            ShareTitle = shareTitle;
            ShareDescription = shareDescription;
            ExpirationTime = expirationTime;
        }

        /// <summary>
        /// 设置分享URL
        /// </summary>
        public virtual void SetShareUrl(string shareUrl)
        {
            ShareUrl = shareUrl;
        }

        /// <summary>
        /// 增加访问次数
        /// </summary>
        public virtual void IncrementAccessCount()
        {
            AccessCount++;
            LastAccessTime = DateTime.Now;
        }

        /// <summary>
        /// 设置密码保护
        /// </summary>
        public virtual void SetPasswordProtection(string password)
        {
            RequiresPassword = !string.IsNullOrWhiteSpace(password);
            AccessPassword = password;
        }

        /// <summary>
        /// 更新权限
        /// </summary>
        public virtual void UpdatePermissions(SharePermissions permissions)
        {
            Permissions = permissions ?? new SharePermissions();
        }

        /// <summary>
        /// 停用分享
        /// </summary>
        public virtual void DeactivateShare()
        {
            ShareStatus = ShareStatus.Inactive;
        }

        /// <summary>
        /// 激活分享
        /// </summary>
        public virtual void ActivateShare()
        {
            ShareStatus = ShareStatus.Active;
        }

        /// <summary>
        /// 检查分享是否有效
        /// </summary>
        public virtual bool IsValid()
        {
            return ShareStatus == ShareStatus.Active &&
                   (!ExpirationTime.HasValue || ExpirationTime.Value > DateTime.Now);
        }

        /// <summary>
        /// 检查是否已过期
        /// </summary>
        public virtual bool IsExpired()
        {
            return ExpirationTime.HasValue && ExpirationTime.Value <= DateTime.Now;
        }
    }

    /// <summary>
    /// 分享类型枚举
    /// </summary>
    public enum ShareType
    {
        /// <summary>
        /// 公开链接
        /// </summary>
        PublicLink = 0,

        /// <summary>
        /// 私有链接
        /// </summary>
        PrivateLink = 1,

        /// <summary>
        /// 社交媒体
        /// </summary>
        SocialMedia = 2,

        /// <summary>
        /// 邮件分享
        /// </summary>
        Email = 3,

        /// <summary>
        /// 二维码
        /// </summary>
        QRCode = 4,

        /// <summary>
        /// 嵌入代码
        /// </summary>
        EmbedCode = 5,

        /// <summary>
        /// 直接用户分享
        /// </summary>
        DirectUser = 6,

        /// <summary>
        /// 群组分享
        /// </summary>
        GroupShare = 7
    }

    /// <summary>
    /// 分享状态枚举
    /// </summary>
    public enum ShareStatus
    {
        /// <summary>
        /// 活跃
        /// </summary>
        Active = 0,

        /// <summary>
        /// 非活跃
        /// </summary>
        Inactive = 1,

        /// <summary>
        /// 已过期
        /// </summary>
        Expired = 2,

        /// <summary>
        /// 已暂停
        /// </summary>
        Suspended = 3,

        /// <summary>
        /// 已撤销
        /// </summary>
        Revoked = 4
    }

    /// <summary>
    /// 分享权限
    /// </summary>
    public class SharePermissions
    {
        /// <summary>
        /// 允许查看
        /// </summary>
        public bool AllowView { get; set; } = true;

        /// <summary>
        /// 允许下载
        /// </summary>
        public bool AllowDownload { get; set; } = false;

        /// <summary>
        /// 允许评论
        /// </summary>
        public bool AllowComment { get; set; } = false;

        /// <summary>
        /// 允许分享
        /// </summary>
        public bool AllowShare { get; set; } = false;

        /// <summary>
        /// 允许嵌入
        /// </summary>
        public bool AllowEmbed { get; set; } = false;

        /// <summary>
        /// 显示水印
        /// </summary>
        public bool ShowWatermark { get; set; } = false;

        /// <summary>
        /// 限制访问次数
        /// </summary>
        public int? AccessLimit { get; set; }

        /// <summary>
        /// 每日访问限制
        /// </summary>
        public int? DailyAccessLimit { get; set; }

        /// <summary>
        /// IP白名单
        /// </summary>
        public List<string> AllowedIPs { get; set; } = new();

        /// <summary>
        /// 地理位置限制
        /// </summary>
        public List<string> AllowedCountries { get; set; } = new();
    }
}